package org.niux.aims.action.ajax;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.niux.aims.common.web.AimsBaseAction;
import org.niux.aims.service.IAccountService;
import org.niux.aims.vo.AccountVO;

/**
 * 
 * Copyright (c) 2009,niux<br>
 * All rights reserved.<br>
 * 
 * 文件名称：GetAccountAjax.java<br>
 * 摘    要：分页获取帐户数据AJAX类<br>
 * <br>
 * 当前版本：<br>
 * 作    者：铭显 Email: <a href="mailto:liangmingxian@gmail.com">liangmingxian@gmail.com</a><br>
 * 完成日期：@since 2013-8-27<br>
 * <br>
 * 取代版本：<br>
 * 原作者  ：<br>
 * 完成日期：@since Oct 22, 2009<br>
 */
public class GetAccountAjax extends AimsBaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2184653423755724613L;

	private int page;
	private int pageSize;
	private String search;
	private List<AccountVO> accounts;
	
	@Resource(name="accountService")
	private IAccountService accountService;

	public GetAccountAjax() {
		this.accounts = new ArrayList<AccountVO>();
	}
	
	/**
	 * 
	 * 方法概述：分页获取账户数据
	 * 描述：分页获取账户数据
	 * @return
	 * 返回类型：String
	 * 修改人：梁铭显
	 * 修改时间：2013-8-27
	 */
	public String getAccountByPage(){
		accounts.clear();
		
		int startPage = page * pageSize;
		
		System.out.println(search);
		accounts = accountService.findByPage(startPage, pageSize,search);
		
		return SUCCESS;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public String getSearch() {
		return search;
	}

	public void setSearch(String search) {
		this.search = search;
	}

	public List<AccountVO> getAccounts() {
		return accounts;
	}

	public void setAccounts(List<AccountVO> accounts) {
		this.accounts = accounts;
	}
}
